#ifndef _AFTER_PROTOCOL_BOOTLOADER_H_
#define _AFTER_PROTOCOL_BOOTLOADER_H_

#include <stdint.h>

/// <summary>
/// 命令类型
/// </summary>
typedef enum 
{
    EntryBootloader=0,Reset=1,Data=2,DataEnd=3,CheckBootloader=4,Erase=5
}AfterBootloader_CmdType;

/// <summary>
/// 发送起始标识
/// </summary>
extern uint8_t g_Bootloader_Receive_StartFlag[2];

/// <summary>
/// 发送结束标识
/// </summary>
extern uint8_t g_Bootloader_Receive_EndFlag[2];

/// <summary>
/// 接收到进入Bootloader帧，反馈
/// </summary>
extern uint8_t g_Bootloader_EntryBootloaderReponse[12];

/// <summary>
/// 检查Bootloader帧，反馈
/// </summary>
extern uint8_t g_Bootloader_CheckBootloaderReponse[12];

/// <summary>
/// 擦除Flash帧，反馈
/// </summary>
extern uint8_t g_Bootloader_EraseFlashReponse[12];

/// <summary>
/// 数据帧梳理完毕回馈
/// FA 55 02 00 00 00 00 00 00 00 56 FB
/// </summary>
extern uint8_t g_Bootloader_DataReponse[12];

/// <summary>
/// 编程结束帧，反馈
/// </summary>
extern uint8_t g_Bootloader_DataProgramEndReponse[12];

/// <summary>
/// 发送起始标识
/// </summary>
extern uint8_t m_Bootloader_Send_StartFlag[2];

/// <summary>
/// 发送结束标识
/// </summary>
extern uint8_t m_Bootloader_Send_EndFlag[2];

//数据解析，返回0xff未异常
AfterBootloader_CmdType Bootloader_DataParse(uint8_t *data, uint8_t dataLength);

#endif